package com.hmall.common.client;

import com.hmall.common.dto.Item;
import com.hmall.common.dto.PageDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "itemservice")
public interface ItemClient {
    // 分页查询接口
    @GetMapping("/item/list")
    PageDTO<Item> list(@RequestParam Integer page, @RequestParam Integer size);

    @GetMapping("/item/{id}")
    public Item getItemById(@PathVariable("id") Long id);

    // 更新库存接口
    @PutMapping("/item/stock/{itemId}/{num}")
    public void reduceStock(@PathVariable("itemId") Long id, @PathVariable("num") Integer num);
}
